<template>
  <div class="shop-info">
    <div class="logo">
      <img :src="shop.logo" />
      <span>{{ shop.name }}</span>
    </div>
    <div class="describe">
      <div class="left">
        <div class="sell">
          <div class="num">{{ shop.sells }}</div>
          <div class="name">总销量</div>
        </div>
        <div class="goods">
          <div class="num">{{ shop.goodsCount }}</div>
          <div class="name">全部宝贝</div>
        </div>
      </div>
      <ul class="right">
        <li v-for="item in shop.score" :key="item.name">
          <span class="title">{{ item.name }}</span>
          <span class="score" :class="[item.isBetter ? 'high' : 'low']">{{
            item.score
          }}</span>
          <span class="quality" :class="[item.isBetter ? 'high' : 'low']">{{
            item.isBetter ? "高" : "低"
          }}</span>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  name: "ShopInfo",
  props: {
    shop: {
      type: Object,
    },
  },
};
</script>

<style scoped>
li,
ul {
  list-style: none;
}
.shop-info {
  font-size: 17px;
  border-top: solid 4px #f2f5f8;
  border-bottom: solid 4px #f2f5f8;
  padding: 20px 0;
}
.logo {
  display: flex;
  line-height: 45px;
  margin-left: 10px;
}
.logo img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: solid 1px #999;
  margin-right: 10px;
}
.describe {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 80px;
  font-size: 14px;
  color: #000;
  margin: 10px 20px;
}
.left {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: space-around;
}
.num {
  font-size: 17px;
}
.sell,
.goods {
  height: 43px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}
.left::after {
  position: absolute;
  right: 0;
  top: 0;
  content: "";
  width: 1px;
  height: 43px;
  background-color: #999;
}
.right {
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}
.right li {
  width: 100%;
  display: flex;
  padding: 0 0 0 20px;
}
.title {
  flex: 2;
}
.score {
  flex: 1;
}
.quality {
  flex: 0.5;
}
.high {
  color: red;
}
.low {
  color: green;
}
</style>